package se19team1e.dao.factory;

import se19team1e.dao.abstrakt.jaas.AccountDAO;
import se19team1e.dao.abstrakt.jaas.AdvertiserDAO;
import se19team1e.dao.abstrakt.jaas.CompanyDAO;
import se19team1e.dao.abstrakt.jaas.DepartmentDAO;
import se19team1e.dao.abstrakt.jaas.JobAdvertDAO;
import se19team1e.dao.abstrakt.jaas.JobResponseDAO;
import se19team1e.dao.impl.property.AccountPropertyDAO;
import se19team1e.dao.impl.property.AdvertiserPropertyDAO;
import se19team1e.dao.impl.property.CompanyPropertyDAO;
import se19team1e.dao.impl.property.DepartmentPropertyDAO;
import se19team1e.dao.impl.property.JobAdvertPropertyDAO;
import se19team1e.dao.impl.property.JobResponsePropertyDAO;
import se19team1e.util.Constants;

/**
 * 
 * An implementation of DAOFactory that creates concrete properties-based DAO.
 * For e.g. Using method of getJobAdvertDAO will return a new instance of Job Advert
 * DAO to the caller. A fix string "JobAdvert.properties" is used
 * 
 * @author Arun Manivannan
 * 
 */
public class PropertyDAOFactory implements DAOFactory {

	/**
	 * Obtains a job advert DAO using using constants "JobAdvert.properties"
	 * 
	 * @return Returns a new instance of Job Advert DAO to the caller
	 */
	@Override
	public JobAdvertDAO getJobAdvertDAO() {
		return new JobAdvertPropertyDAO(Constants.JOBADVERT_PROPERTIES);
	}

	/**
	 * Obtains a Account DAO using using constants "Account.properties"
	 * 
	 * @return Returns a new instance of Account DAO to the caller
	 */
	@Override
	public AccountDAO getAccountDAO() {
		return new AccountPropertyDAO(Constants.ACCOUNT_PROPERTIES);
	}

	/**
	 * Obtains a Advertiser DAO using using constants "Advertiser.properties"
	 * 
	 * @return Returns a new instance of Advertiser DAO to the caller
	 */
	@Override
	public AdvertiserDAO getAdvertiserDAO() {
		return new AdvertiserPropertyDAO(Constants.ADVERTISER_PROPERTIES);
	}

	/**
	 * Obtains a Company DAO using using constants "Company.properties"
	 * 
	 * @return Returns a new instance of Company DAO to the caller
	 */
	@Override
	public CompanyDAO getCompanyDAO() {
		return new CompanyPropertyDAO(Constants.COMPANY_PROPERTIES);
	}

	/**
	 * Obtains a Department DAO using using constants "Department.properties"
	 * 
	 * @return Returns a new instance of Department DAO to the caller
	 */
	@Override
	public DepartmentDAO getDepartmentDAO() {
		return new DepartmentPropertyDAO(Constants.DEPARTMENT_PROPERTIES);
	}

	@Override
	public JobResponseDAO getJobResponseDAO() {
		return new JobResponsePropertyDAO(Constants.JOBRESPONSE_PROPERTIES);
	}
}
